package com.pig.util;


import com.pig.pojo.user.User;

/**
 * shiro框架登录以后存入，获取用户时可以取出去
 */
public class UserThreadLocal {
    //在同一线程内有效!!!!!!
    private static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public static void set(User user){  //存

        userThreadLocal.set(user);
    }

    public static User get(){           //取

        return userThreadLocal.get();
    }

    public static void remove(){        //删除

        userThreadLocal.remove();
    }


}
